package com.campus.user.controller;


import com.campus.common.result.Result;
import com.campus.common.student.job.entity.Student;
import com.campus.common.student.job.entity.dto.AddStudentDTO;
import com.campus.common.student.service.IStudentService;
import com.campus.common.user.entity.dto.InsertUserDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

/**
 * <p>
 * 学生信息表 前端控制器
 * </p>
 *
 * @author mwb
 * @since 2024-11-17
 */
@RestController
@RequestMapping("/student")
@Tag(name = "学生信息管理")
public class StudentController {

    @Autowired
    private IStudentService studentService;

    @PostMapping("/addStudent")
    @Operation(summary = "完善学生信息")
    public Result addStudentFun(@RequestBody AddStudentDTO addStudentDTO){
        return studentService.addStudent(addStudentDTO);
    }

    @PutMapping("/editStudent")
    @Operation(summary = "编辑学生信息")
    public Result editStudentFun(@RequestBody Student student){
        return studentService.editStudent(student);
    }

    @Operation(summary = "新增学生信息")
    @PostMapping("/insertStudent")
    public Result insertStudentFun(@RequestBody InsertUserDTO insertUserDTO){
        return studentService.insertStudent(insertUserDTO);
    }

}
